/**
 * 获取豆瓣歌曲的信息
 * @param config 配置
 *      success   找到Model时执行
 * @constructor 实例化
 */
function DoubanSongObtainer(config) {
    this.model = null;
    this.config = config;
    this._init();
}

// 初始化
DoubanSongObtainer.prototype._init = function () {
    var me = this;
    var c = new valaxyCircle({
        execute: function () {
            if ($('#douban_title').length > 0) {
                me.model = new SongModel();
                me.model.title = $('#douban_title').text();
                me.model.artist = $('#douban_artist').text();
                if (me.config.success) {
                    me.config.success();
                }
                $('#douban_title').remove();
                $('#douban_artist').remove();
            }
        },
        timeout: 500
    });
}


/**
 * 获取豆瓣的SongModel
 * @returns 一个SongModel实例
 */
DoubanSongObtainer.prototype.getModel = function () {
    return this.model;
}